#include "MatrixCommon.h"
#include "MatrixDiagonal.h"
#include "MatrixTriangular.h"

int main(int argc, char *argv[]) {
	MatrixCommon<float> common01(2,3);
	MatrixCommon<float> common02(2,3);
	common01 << 1,4,2,2,0,0;
	common02 << 0,0,5,7,5,0;
	common01 += common02;
	MatrixCommon<float> common03(common01);
	common03.Print();
	common03 -= common02;
	common03.Print();

	MatrixDiagonal<int> diagonal01(3);
	diagonal01 << 1,2,3;
	MatrixCommon<int> common04(diagonal01);
	MatrixDiagonal<int> diagonal02(common04);
	MatrixCommon<int> common05(3,3);
	common05 = diagonal01;
	MatrixDiagonal<int> diagonal03(3);
	diagonal03 = common04;
	diagonal03.Print();
	const MatrixDiagonal<int> diagonal04(diagonal03);
	MatrixDiagonal<int> diagonal05(common04);
	cout << "-" << diagonal04[0] << diagonal04[1] << diagonal04[2] << "-";
	cout << "-" << diagonal05[0] << diagonal05[1] << diagonal05[2] << "-\n";
	const MatrixCommon<int> common06(common04);
	MatrixCommon<int> common07(diagonal05);	
	cout << "=" << common06[0][0] << common06[1][1] << common06[2][2] << "=";	
	cout << "=" << common07[0][0] << common07[1][1] << common07[2][2] << "=\n";

	MatrixCommon<long> common10(3,3);
	MatrixCommon<long> common100(3,3);
	MatrixCommon<long> common11(3,3);
	MatrixCommon<long> common12(3,3);
	MatrixCommon<long> common13(3,3);
	MatrixCommon<long> common14(3,3);
	MatrixCommon<long> common15(3,3);
	MatrixDiagonal<long> diagonal10(3);
	MatrixDiagonal<long> diagonal11(3);
	MatrixDiagonal<long> diagonal12(3);
	MatrixDiagonal<long> diagonal13(3);
	MatrixDiagonal<long> diagonal14(3);
	MatrixDiagonal<long> diagonal15(3);
	common10 << 5,1,1,2,5,2,3,3,5;
	cout << "IsDiagonal()=" << common10.IsDiagonal() << endl;
	diagonal10 << 5,5,5;
	common11 = common10 + diagonal10;
	common12 = diagonal10 + common10;
	common12.Print();
	common100 << 5,0,0,0,5,0,0,0,5;
	cout << "IsDiagonal()=" << common100.IsDiagonal() << endl;
	diagonal11 = common100 + diagonal10;
	diagonal12 = diagonal10 + common100;
	diagonal13 = diagonal12 + diagonal12;
	diagonal13.Print();
	diagonal14 = common100 * diagonal10;
	diagonal15 = diagonal10 * common100;
	diagonal15.Print();
	common13 = common10 * diagonal10;
	common14 = diagonal10 * common10;
	common14.Print();
	common15 = common10 * common10;
	common15.Print();

	MatrixCommon<double> common20(2,3);
	MatrixCommon<double> common21(3,2);
	MatrixCommon<double> common22(2,2);
	MatrixCommon<double> common23(3,3);
	MatrixCommon<double> common24(3,3);
	MatrixCommon<double> common25(3,3);
	MatrixDiagonal<double> diagonal20(3);
	MatrixDiagonal<double> diagonal21(3);
	MatrixDiagonal<double> diagonal22(3);
	common20 << 1,0,2,-1,3,1;
	common21 << 3,1,2,1,1,0;
	common22 = common20 * common21;
	common22.Print();
	common23 << 0,1,2,3,4,5,6,7,8;
	diagonal20 << 1,2,3;
	common23 *= diagonal20;
	common23.Print();
	common23 *= 2;
	common24 = common23 * 2;
	common25 = 2 * common23;
	common25.Print();
	diagonal21 = 3 * diagonal20;
	diagonal22 = diagonal20 * 3;
	diagonal22.Print();

	MatrixCommon<double> common30(2,3);
	MatrixCommon<double> common31(3,2);	
	common30 << 2,4,3,0,-2,8;
	common31 = common30.Transpose();
	common31.Print();

	MatrixTriangular<int> triangular01(3);
	MatrixTriangular<int> triangular02(3, MatrixTriangular<int>::MATRIX_TRIANGULAR_UPPER);
	MatrixTriangular<int> triangular03(3);
	MatrixTriangular<int> triangular04(3);
	MatrixTriangular<int> triangular05(3);
	triangular01 << 1,
		2,2,
		3,3,3;
	triangular01.Print();
	cout << "==" << triangular01[0][0] 
		<< triangular01[1][1] 
		<< triangular01[2][2] << "==\n";	
	triangular02 = triangular01.Transpose();
	triangular02.Print();
	triangular03 = triangular02.Transpose();
	triangular03.Print();
	triangular04 = triangular01 + triangular03;
	triangular04 += triangular01;
	triangular04.Print();
	triangular05 = triangular01 * triangular03;
	triangular05.Print();

	return 0;
}

